class furniture():
    def __init__(self,name,area):
        self.name=name;
        self.area=area

class home():
    def __init__(self,address,area):
        self.address = address
        self.area = area
        self.free_area=area
        self.furniture=[]
    def __str__(self):
        return f'房子坐落于{self.address},占地面积{self.area},'f'剩余面积{self.free_area},家具有{self.furniture}'
    def add_furniture(self,item):
        if self.free_area>=item.area:
            self.furniture.append(item.name)
            self.free_area-=item.area
        else:
            print('家具太大,剩余面积不足,无法容纳')

if __name__ == '__main__':
    jia = home('北京', 140)
    bed = furniture('床', 6)
    sofa = furniture('沙发', 10)
    ball = furniture('篮球场', 1200)
    jia.add_furniture(bed)
    print(jia)
    jia.add_furniture(sofa)
    print(jia)
    jia.add_furniture(ball)
    print(jia)
